/** COPYRIGHT(C) 2008. Loc Phan. All Rights Reserved.
    A program that horizontally mirror a picture
    @author Loc Phan
    @version 1.01 2008-10-30
*/
public class HorizontalMirror
{

   public static void main(String[] args)
   {
      Picture original = new Picture("/Users/locphan/Documents/workspace/Lab9/src/JamesGosling.jpg");
      Picture modifier = new Picture("/Users/locphan/Documents/workspace/Lab9/src/JamesGosling.jpg");
      
      int width = modifier.getWidth();
      int height = modifier.getHeight();
      
      int midpoint = height/2;
      int last = height - 1;
      
      Pixel up = null;
      Pixel down = null;
      
      for(int y=0;y<midpoint;y++)
      {
         for(int x=0;x<width;x++)
         {
            up = modifier.getPixel(x, y);
            down = modifier.getPixel(x,last-y);
            
            up.setColor(down.getColor());
            down.setColor(up.getColor());
         }
      }
      
      original.show();
      modifier.show();

    }

}
